package com.SunSoft.PhoneRemoteControl;

import android.media.AudioRecord;
import android.media.AudioRecord.OnRecordPositionUpdateListener;
import android.util.Log;
import java.io.IOException;
import java.io.RandomAccessFile;

final class h
  implements AudioRecord.OnRecordPositionUpdateListener
{
  public final void onMarkerReached(AudioRecord paramAudioRecord)
  {
  }

  public final void onPeriodicNotification(AudioRecord paramAudioRecord)
  {
    int i = 0;
    int j = 0;
    while (true)
    {
      try
      {
        g.a(this.a).read(g.b(this.a), 0, g.b(this.a).length);
        g.c(this.a).write(g.b(this.a));
        paramAudioRecord = this.a;
        g.a(paramAudioRecord, g.d(paramAudioRecord) + g.b(this.a).length);
        if (g.e(this.a) == 16)
        {
          i = j;
          if (i >= g.b(this.a).length / 2)
            return;
          j = g.a(g.b(this.a)[(i * 2)], g.b(this.a)[(i * 2 + 1)]);
          if (j <= g.f(this.a))
            break label238;
          g.b(this.a, j);
          break label238:
        }
        do
        {
          if (g.b(this.a)[i] <= g.f(this.a))
            break label245;
          g.b(this.a, g.b(this.a)[i]);
          break label245:
          j = g.b(this.a).length;
        }
        while (i < j);
        return;
      }
      catch (IOException paramAudioRecord)
      {
        Log.e(g.class.getName(), "Error occured in updateListener, recording is aborted");
        Log.e(g.class.getName(), paramAudioRecord.getMessage());
        return;
      }
      catch (java.lang.NullPointerException paramAudioRecord)
      {
        Log.e("Test", "读取bufffer 错误");
        return;
      }
      label238: i += 1;
      continue;
      label245: i += 1;
    }
  }
}